1 디지털 뉴딜 발표

정부혁신1번가 웹사이트에서 HOME > 디지털 정부혁신 > 디지털정부혁신자료실 에서 한국판 뉴딜 및 디지털 뉴딜 계획자료 보고서를 만날 수 있다.

library(tidyverse)
library(slickR)
library(pdftools)

ND_pdf <- pdf_convert("data/200715_digital_new_deal_report.pdf",format = 'png',verbose = FALSE)
ND_detail_pdf <- pdf_convert("data/200714_digital_new_deal_report_deail.pdf",format = 'png',verbose = FALSE)

1.1 디지털 뉴딜 종합계획

# ND_pdf %>% write_rds("data/ND_pdf.rds")
ND_pdf <- read_rds("data/ND_pdf.rds")

ND_pdf_df <- tibble(page = glue::glue("fig/{ND_pdf}") )
  
slickR(ND_pdf_df$page, height = 600)

1.2 한국판 뉴딜 종합계획

# ND_detail_pdf %>% write_rds("data/ND_detail_pdf")
ND_detail_pdf <- read_rds("data/ND_detail_pdf")

ND_detail_pdf_df <- tibble(page = glue::glue("fig/{ND_detail_pdf}") )
  
slickR(ND_detail_pdf_df$page, height = 600)

1.3 한국판 뉴딜1

기획재정부 한국판 뉴딜 웹사이트에 확고한 사람중심 포용국가 기반 위에 디지털(digital) 뉴딜그린(green) 뉴딜 두 개의 축으로 추진하며, 2025년까지 총160조원(국비 114.1조원)을 투입하고 총190.1만개 일자리를 창출하겠다는 내용이 정리되어 있다.

library(collapsibleTree)
library(tidyverse)
library(readxl)

한국판뉴딜 <- read_excel("data/한국판뉴딜.xlsx")

collapsibleTree(한국판뉴딜, 
                hierarchy = c("레벨1", "레벨2", "레벨3"),
                tooltip = TRUE,
                attributes = "레벨1")

2 재원과 일자리

2.1 분야별 세부과제 투자/일자리

library(magick)

jobs_img <- image_read("fig/new-deal-investment-jobs.jpg")

jobs_img

먼저 데이터를 이미지에서 OCR할 수 있는지 살펴보자.

library(tesseract)
library(image.binarization)

only_numbers <- tesseract(options = list(tessedit_char_whitelist = ".0123456789"))

jobs_img %>% 
  image_crop("400x965+520+100")

jobs_img %>% 
  image_crop("400x650+500+100") %>% 
  tesseract::ocr(engine = only_numbers)
[1] "18644890.3\n125319567\n3164295\n65148172\n259791\n041009\n060809\n030304\n030505\n2113.4\n0.2 0405\n0.6 0709\n03 1.0 12.0\n44100193\n3785124\n061214\n010355\n196427659\n61121387\n2662243\n120025105\n233439\n103243209\n2020\n3692038\n561151\n326363\n2036047\n122716\n"
## '20추 ~ '22추    
field_01 <- jobs_img %>% 
  image_crop("50x650+520+100") %>% 
  # image_convert(format = "PGM", colorspace = "Gray") %>% 
  # image_binarization(type = "otsu") %>% 
  tesseract::ocr(engine = only_numbers) 

field_01_df <- field_01 %>% 
  str_split(pattern = "\n") %>% 
  as.data.frame() %>% 
  set_names("20-22") %>% 
  as_tibble()

field_01_df
# A tibble: 29 x 1
   `20-22`
   <chr>  
 1 18.6   
 2 12.5   
 3 31     
 4 65     
 5 25     
 6 0.4    
 7 06     
 8 03     
 9 03     
10 11     
# ... with 19 more rows
## '20추 ~ '25추    
field_02 <- jobs_img %>% 
  image_crop("50x650+580+100") %>% 
  # image_convert(format = "PGM", colorspace = "Gray") %>% 
  # image_binarization(type = "otsu") %>% 
  tesseract::ocr(engine = only_numbers) 

field_02_df <- field_02 %>% 
  str_split(pattern = "\n") %>% 
  as.data.frame() %>% 
  set_names("20-25") %>% 
  as_tibble() %>% 
  filter(`20-25` != "")

## 일자리
field_03 <- jobs_img %>% 
  image_crop("50x650+650+100") %>% 
  # image_convert(format = "PGM", colorspace = "Gray") %>% 
  # image_binarization(type = "otsu") %>% 
  tesseract::ocr(engine = only_numbers) 

field_03_df <- field_03 %>% 
  str_split(pattern = "\n") %>% 
  as.data.frame() %>% 
  set_names("일자리") %>% 
  as_tibble()

## 분야
sub_names <- tribble(~"subnames",
                     "합계",
                     "소계",
                     "", "", "", "",
                     "소계",
                     "", "",
                     "소계",
                     "", "", "",
                     "소계",
                     "", "", "",
                     "합계",
                     "소계",
                     "", "", "",
                     "소계",
                     "", "", "",
                     "소계",
                     "", "")
ocred_df <- bind_cols(sub_names) %>% 
  bind_cols(field_01_df) %>% 
  bind_cols(field_02_df) %>% 
  bind_cols(field_03_df) %>% 
  filter(subnames =="") %>% 
  bind_cols(한국판뉴딜 %>% filter(`레벨1` %in% c("디지털뉴딜", "그린뉴딜"))) %>% 
  select(레벨0, 레벨1, 레벨2, 레벨3,  `20-22`, `20-25`, 일자리)

ocred_df
# A tibble: 20 x 7
   레벨0    레벨1   레벨2           레벨3                 `20-22` `20-25` 일자리
   <chr>    <chr>   <chr>           <chr>                 <chr>   <chr>   <chr> 
 1 한국판 뉴딜~ 디지털뉴딜~ D.N.A. 생태계 강화~ 국민생활과 밀접한 분야 데이터 구축ㆍ~ "31"    64      "295" 
 2 한국판 뉴딜~ 디지털뉴딜~ D.N.A. 생태계 강화~ 1ㆍ2ㆍ3차 전(全)산업으로 5GㆍA~ "65"    148     "172" 
 3 한국판 뉴딜~ 디지털뉴딜~ D.N.A. 생태계 강화~ 5GㆍAI 기반 지능형 정부~ "25"    97      "91"  
 4 한국판 뉴딜~ 디지털뉴딜~ D.N.A. 생태계 강화~ K-사이버 방역체계 구축~ "0.4"   1.0     "09"  
 5 한국판 뉴딜~ 디지털뉴딜~ 교육 인프라 디지털 전환~ 모든 초중고에 디지털 기반 교육 인프~ "03"    03      "04"  
 6 한국판 뉴딜~ 디지털뉴딜~ 교육 인프라 디지털 전환~ 전국 대학ㆍ직업훈련기관 온라인 교육 ~ "03"    05      "13.4"
 7 한국판 뉴딜~ 디지털뉴딜~ 비대면 산업 육성~ 스마트 의료 및 돌봄 인프라 구축~ "0.2"   04      "09"  
 8 한국판 뉴딜~ 디지털뉴딜~ 비대면 산업 육성~ 중소기업 원격근무 확산~ "0.6"   07      "120" 
 9 한국판 뉴딜~ 디지털뉴딜~ 비대면 산업 육성~ 소상공인 온라인 비즈니스 지원~ "03"    1.0     "19.3"
10 한국판 뉴딜~ 디지털뉴딜~ SOC 디지털화    4대 분야 핵심 인프라 디지털 관리체~ "37"    85      "14"  
11 한국판 뉴딜~ 디지털뉴딜~ SOC 디지털화    도시ㆍ산단의 공간 디지털 혁신~ "0.6"   12      "55"  
12 한국판 뉴딜~ 디지털뉴딜~ SOC 디지털화    스마트 물류체계 구축  "1"     03      "65.9"
13 한국판 뉴딜~ 그린뉴딜~ 도시ㆍ공간ㆍ생활 인프라 녹~ 국민생활과 밀접한 공공시설 제로에너지~ "26"    62      "105" 
14 한국판 뉴딜~ 그린뉴딜~ 도시ㆍ공간ㆍ생활 인프라 녹~ 국토ㆍ해양ㆍ도시의 녹색 생태계 회복~ "12"    25      "39"  
15 한국판 뉴딜~ 그린뉴딜~ 도시ㆍ공간ㆍ생활 인프라 녹~ 깨끗하고 안전한 물 관리체계 구축~ "23"    34      "20.9"
16 한국판 뉴딜~ 그린뉴딜~ 저탄소<U+2027>분산형 에너지 확산~ 에너지관리 효율화 지능형 스마트 그리~ "36"    20      "38"  
17 한국판 뉴딜~ 그린뉴딜~ 저탄소<U+2027>분산형 에너지 확산~ 신재생에너지 확산기반 구축 및 공정한~ "56"    92      "151" 
18 한국판 뉴딜~ 그린뉴딜~ 저탄소<U+2027>분산형 에너지 확산~ 전기차ㆍ수소차 등 그린 모빌리티 보급~ "3.2"   31      "63"  
19 한국판 뉴딜~ 그린뉴딜~ 녹색산업혁신 생태계구축~ 녹색 선도 유망기업 육성 및 저탄소ㆍ~ "12"    36      "16"  
20 한국판 뉴딜~ 그린뉴딜~ 녹색산업혁신 생태계구축~ R&Dㆍ금융 등 녹색혁신 기반 조성~ ""      27      ""    

2.2 투자 재원

library(data.tree)

finance_df <- read_excel("data/한국판뉴딜.xlsx", sheet="finance")

finance_df$pathString <- paste(finance_df$레벨0,
                               finance_df$레벨1, 
                               finance_df$레벨2,
                               finance_df$레벨3,
                               sep = "/")

nd_finance <- as.Node(finance_df)

nd_finance$Do(function(node) node$재원 <- data.tree::Aggregate(node, attribute = "재원", aggFun = sum))

collapsibleTree(nd_finance, 
                zoomable = FALSE,
                collapsed = FALSE,
                nodeSize  = "재원", attribute = "재원", tooltip = TRUE)
[1] "Node$fields will be deprecated in the next release. Please use Node$attributes instead."
[1] "Node$fields will be deprecated in the next release. Please use Node$attributes instead."

2.3 일자리

nd_finance$Do(function(node) node$일자리 <- data.tree::Aggregate(node, attribute = "일자리", aggFun = sum))

collapsibleTree(nd_finance, 
                zoomable = FALSE,
                collapsed = FALSE,
                nodeSize  = "일자리", 
                attribute = "일자리", tooltip = TRUE)
[1] "Node$fields will be deprecated in the next release. Please use Node$attributes instead."
[1] "Node$fields will be deprecated in the next release. Please use Node$attributes instead."
 

데이터 과학자 이광춘 저작

kwangchun.lee.7@gmail.com